Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Jan 8, 2026

Summary

Fix runtime error when calling .trim() on non-string span.description values.

Root Cause

The Span.description property is typed as string | null | undefined. The previous code used String(span?.description).trim() which converts:

  • null"null" (literal string)
  • undefined"undefined" (literal string)

These incorrect values passed through the .delete("") cleanup and appeared as valid queries/resources.

Fix

Use nullish coalescing (??) to return an empty string for null/undefined, which the existing cleanup handles correctly:

// Before
String(span?.description).trim()

// After
(span.description ?? "").trim()

Fixes SPOTLIGHT-ELECTRON-4V

Use nullish coalescing operator instead of String() to prevent
'null' and 'undefined' literal strings from appearing as valid
query/resource entries when span.description is not a string.

Fixes SPOTLIGHT-ELECTRON-4V
@BYK BYK deployed to Preview January 8, 2026 00:11 — with GitHub Actions Active
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
spotlightjs Skipped Skipped Jan 8, 2026 0:11am

@BYK BYK marked this pull request as ready for review January 8, 2026 00:43
@BYK BYK merged commit cd0f898 into main Jan 8, 2026
18 checks passed
@BYK BYK deleted the fix/span-description-null-safety branch January 8, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants